package ru.amse.podolsky.fractalarch.model;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Алексей
 */

//package ru.amse.podolsky.fractalarch;
import java.awt.image.*;

public class BlockLineParams {
    
    //Constants
    private static final int blockSize = IParams.BLOCK_SIZE;
    
    public int imageWidthInBlocks;
    public int imageHeightInBlocks;
    
    public BlockLineParams(){
        this.imageWidthInBlocks = 0;
        this.imageHeightInBlocks = 0;
    }        
    
    public BlockLineParams getImageLineParamsInBlocks(BufferedImage image, int step){
        int imgWidth = image.getWidth();
        int imgHeight = image.getHeight();
        BlockLineParams params = new BlockLineParams();
        
        int width = imgWidth - blockSize;
        int height = imgHeight - blockSize;
        if(step > blockSize){
            step = blockSize;
        }       
        
        if(width % step == 0){
            params.imageWidthInBlocks = width / step + 1;
        }else{
            params.imageWidthInBlocks = width / step + 2;
        }
        if(height % step == 0){
            params.imageHeightInBlocks = height / step + 1;
        }else{
            params.imageHeightInBlocks = height / step + 2;
        }
        
        return params;
   }
}
